package comm

import (
	"reflect"
	"unsafe"
)

// DirectBytes 获取一个对象的底层存储空间
func DirectBytes(p unsafe.Pointer, n int) []byte {
	hdr := new(reflect.SliceHeader)
	hdr.Data = uintptr(p)
	hdr.Len = n
	hdr.Cap = n
	return *(*[]byte)(unsafe.Pointer(hdr))
}
